const app = getApp()
Component({
  properties: {
    navbarData: {   //navbarData   由父页面传递的数据，变量名字自命名
      type: Object,
      value: {},
      observer: function (newVal, oldVal) { }
    }
  },
  data: {
    height: '',
    //默认值  默认显示左上角
    navbarData: {
      showCapsule: 1,
      showSelect: 0,
      share: 0
    },
    index: 0
  },
  attached: function () {
    // 定义导航栏的高度   方便对齐
    this.setData({
      statusBarHeight: app.globalData.statusBarHeight
    })
  },
  methods: {
    // 返回上一页面
    _navback() {
      wx.navigateBack()
    },
    //返回到首页
    _backhome() {
      wx.switchTab({
        url: '/pages/index/index',
      })
    },
    bindPickerChange: function (e) {
      this.setData({
        index: e.detail.value
      })
      var ar = this.data.navbarData.schoolsArry[e.detail.value]
      wx.setStorageSync("student_id", ar.id ? ar.id : 0)
      wx.setStorageSync("grades_id", ar.grades_id ? ar.grades_id : 0)
    }
  }

}) 